Theory of relations